package network;


import java.io.*;
import java.net.ConnectException;
import java.net.Socket;
import java.util.Scanner;

public class Client {

    static final int port = 8888;

    public static void main(String[] args) throws Exception {

        //while(true) {
        try {
        Socket socket = new Socket("192.168.0.10", port);
        System.out.println("SOCKET = " + socket);
                PrintWriter pred = new PrintWriter(
                             new BufferedWriter(
                                new OutputStreamWriter(socket.getOutputStream())),
                             true);
        String str ="";
        //while (!(str.equals("\\quit"))) {
         //   Scanner sc = new Scanner(System.in);
          //  str = sc.nextLine();
            pred.println("message");
            pred.flush();
        //}
        socket.close();
        } catch ( ConnectException e) {
            System.out.println("Impossible de se connecter");
        }
      //  }
//       
//
//        BufferedReader plec = new BufferedReader(
//                               new InputStreamReader(socket.getInputStream())
//                               );
//

//       do { str = plec.readLine();      // lecture de l'écho
//        System.out.println(str);
//        // pred.println("END") ;
//       } while ( str != null);
//        plec.close();
//       // pred.close();
//        socket.close();
    }
}
